/*
 * @Author: Yang Zhang
 * @Date: 2021-12-04 15:43:04
 * @LastEditors: Yang Zhang
 * @LastEditTime: 2021-12-21 16:31:29
 * @Description: 
 */

import { request } from "../utils/request"
import { ICardadditem, IWithdraw } from "./types"


const api = {
  incomelist: '/store/wallet/log/commission',
  wallet: '/store/member/wallet',
  withdrawlist: '/store/member/withdrawApply',
  kolOrderlst: '/store/orders/getKOL',
  banklist: '/store/member/bankCard',
  addCard: '/store/member/bankCard/add',
  delCard: '/store/member/bankCard/delete/',
  withdraw: '/store/member/wallet/withdrawal',
  orderdetail: '/store/orders/'
}


export const getIncomelist = (data: any) => {
  return request({
    url: api.incomelist,
    method: 'get',
    params: data
  })
}


export const getWallet = () => {
  return request({
    url: api.wallet,
    method: 'get'
  })
}

export const withdrawList = (data: any) => {
  return request({
    url: api.withdrawlist,
    method: 'get',
    params: data
  })
}

export const getOrderlst = (data: any) => {
  return request({
    url: api.kolOrderlst,
    method: 'get',
    params: data
  })
}

export const getbankcardlst = (type: Number) => {
  return request({
    url: api.banklist,
    method: 'get',
    params: {
      cardType: type
    }
  })
}

export const addCarditem = (data: ICardadditem) => {
  return request({
    url: api.addCard,
    method: 'post',
    data,
    formData: true
  })
}

export const delCard = (number: string) => {
  return request({
    url: api.delCard + number,
    method: 'delete',
  })
}

export const withdrawMoney = (data: IWithdraw) => {
  return request({
    url: api.withdraw,
    method: 'post',
    formData: true,
    data
  })
}

export const getOrderdetail = (sn: any) => {
  return request({
    url: api.orderdetail + sn,
    method: 'get'
  })
}